/*数组实现栈*/
const stack=[]
stack.push(1)
stack.push(2)
stack.push(3)
stack.push(4)
console.log(stack);
while (stack.length) {
    let t=stack[stack.length-1]
    console.log(t);
    stack.pop(t)
    console.log(stack);
    
}